import numpy as np
import pandas as pd
arr= np.random.randint(1,20,size=(3,3))
df=pd.DataFrame(arr)
print("原始数据:\n",df)
print("按第二行的值升序排序:\n",df.sort_values(by=1,axis=1))
print("按第二列的值升序排序:\n",df.sort_values(by=1))
df.columns=['a','b','c']
print("设置列标签后的原始数据:\n",df)
print("按a列的值降序排序:\n",df.sort_index(ascending=False))